global_defs {
   router_id 201
}

vrrp_script check_haproxy {
    script "killall -0 haproxy"
    interval 3
    fall 5
    rise 10
}

vrrp_instance haproxy {
{% if keepalived_master is defined %}
    state MASTER
    priority 200
{% else %}
    state BACKUP
    priority 190
{% endif %}
    interface {{ ansible_default_ipv4['interface'] }}
    virtual_router_id 51
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass password
    }
    virtual_ipaddress {
        {{master_vip}}
    }
    track_script {
        check_haproxy
    }
}